import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

// 解决重复点击导航路由报错
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
}

export default new Router({
    routes: [{
        path: '/',
        component: () =>
            import ("@/views/Home"),
        children: [{
                path: '/',
                name: 'overview',
                component: () =>
                    import ("@/views/home/overview.vue")
            },
            {
                path: '/contentModel',
                name: 'contentModel',
                component: () =>
                    import ("@/views/contentModel/contentModel.vue"),
                redirect: '/contentModel/comment',
                children: [{
                        path: '/contentModel/comment',
                        name: 'comment',
                        component: () =>
                            import ("@/views/contentModel/home/comment.vue"),
                    },
                    {
                        path: '/contentModel/paihao',
                        name: 'paihao',
                        component: () =>
                            import ("@/views/contentModel/home/paihao.vue"),
                    },
                    {
                        path: '/contentModel/order',
                        name: 'order',
                        component: () =>
                            import ("@/views/contentModel/home/order.vue"),
                    },
                    {
                        path: '/contentModel/variety',
                        name: 'variety',
                        component: () =>
                            import ("@/views/contentModel/home/variety.vue"),
                    },
                    {
                        path: '/contentModel/banner',
                        name: 'admin',
                        component: () =>
                            import ("@/views/contentModel/home/admin.vue"),
                    },
                    {
                        path: '/contentModel/banner',
                        name: 'banner',
                        component: () =>
                            import ("@/views/contentModel/home/banner.vue"),
                    },
                ]
            },
            {
                path: '/contentCollection/comment',
                name: 'Comment',
                component: () =>
                    import ("@/views/contentCollection/comment.vue")
            },
            {
                path: '/contentCollection/variety',
                name: 'Variety',
                component: () =>
                    import ("@/views/contentCollection/variety.vue")
            },
            {
                path: '/contentCollection/admin',
                name: 'Admin',
                component: () =>
                    import ("@/views/contentCollection/admin.vue")
            },
            {
                path: '/contentCollection/banner',
                name: 'Banner',
                component: () =>
                    import ("@/views/contentCollection/banner.vue")
            },
            {
                path: '/contentCollection/paihao',
                name: 'Paihao',
                component: () =>
                    import ("@/views/contentCollection/paihao.vue")
            },
            {
                path: '/contentCollection/order',
                name: 'Order',
                component: () =>
                    import ("@/views/contentCollection/order.vue")
            },
            {
                path: '/marketing',
                name: 'marketing',
                component: () =>
                    import ("@/views/home/marketing.vue")
            },
            {
                path: '/webhook',
                name: 'webhook',
                component: () =>
                    import ("@/views/home/webhook.vue")
            },
            {
                path: '/setting',
                name: 'setting',
                component: () =>
                    import ("@/views/home/setting.vue")
            },
        ]
    }]
})